<!--
 * @Description:
 * @Author: ZachGmy
 * @Date: 2020-09-03 09:57:40
 * @LastEditors: 灰佳小白 1150248441@qq.com
 * @LastEditTime: 2022-06-29 14:53:16
-->
<template>
  <div>
    <div class="button">
      <!-- 上报按钮 -->
      <el-button type="primary" size="small" @click="toInput">上报</el-button>
      <router-view></router-view>
    </div>
    <!-- 列表部分 -->
    <div class="list">
      <el-table :data="covidData" style="width: 100%">
        <el-table-column type="index" label="序号">
        </el-table-column>
        <el-table-column prop="country" label="国">
        </el-table-column>
        <el-table-column prop="province" label="省">
        </el-table-column>
        <el-table-column prop="city" label="市">
        </el-table-column>
        <el-table-column prop="area" label="区">
        </el-table-column>
        <el-table-column prop="confirmed" label="新增确诊">
        </el-table-column>
        <el-table-column prop="suspected" label="疑似">
        </el-table-column>
        <el-table-column prop="dead" label="死亡">
        </el-table-column>
        <el-table-column prop="cure" label="治愈">
        </el-table-column>
        <el-table-column prop="severe" label="重症">
        </el-table-column>
        <el-table-column prop="outside" label="境外输入">
        </el-table-column>
        <el-table-column prop="inputTime" label="上报时间" width="150">
          <template v-slot:default="scope">
            {{scope.row.inputTime |fmtDate}}
          </template>
        </el-table-column>
      </el-table>
    </div>

  </div>
</template>

<script>
import { get } from '@/utils/request'
export default {
  data() {
    return {
      covidData: []
    }
  },
  methods: {
    // 跳转到数据上报页面
    toInput() {
      this.$router.push({ path: '/data/input' })
    },
    // 获取疫情数据列表
    async getcovidData() {
      let params = {
        page: 1,
        pageSize: 10
      }
      let res = await get('/epidemic/pageQuery', params)
      // console.log(res.data.list)
      this.covidData = res.data.list
    }
  },
  created() {
    this.getcovidData()
  }
}
</script>

<style scoped>
</style>
